<!DOCTYPE HTML>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css"/>
    <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/plugins/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/plugins/PNotify/pnotify.custom.min.css">
    <style type="text/css">
        html {
            height: 100%;
        }

        body {
            background: #EFF3FC;
            height: 100%;
        }

        .content {
            margin-left: 0;
            margin-top: 0;
            width: auto;
            padding: 0px 20px 0 20px;
            height: 97%;
        }

        table {
            width: 90%;
            margin: 0 auto;
        }

        tr {
            /*height: 30px;*/
            text-align: center;
        }

        .table tbody > tr > td {
            border-top: 0px;
        }

        tr:first-child {
            text-align: center;
        }

        tr th {
            text-align: center;
        }

        button, input {
            line-height: normal;
        }

        .shareTable {
            background: #ffffff;
            border-radius: 10px;
            border: 1px solid #cccccc;
            height: 93%;
        }

        .shareTable table {
            width: 95%;
            margin: 0 auto;
            margin-top: 22px;
        }

        .shareTable .tabelSty {
            height: 87%;
        }

        #demo7 {
            margin-left: 3%;
            border-top: 1px solid #eeeeee;
        }

        .table thead > tr > th, .table tbody > tr > th, .table tfoot > tr > th, .table thead > tr > td, .table tbody > tr > td, .table tfoot > tr > td {
            vertical-align: middle;
        }

        tr {
            height: 45px;
        }

        .optionType {
            border: 1px solid #9d9d9d;
            background: #ffffff;
            position: absolute;
            border-radius: 5px;
            top: 51%;
            right: -2px;
            z-index: 100;
        }

        .optionType ul {
        {#            padding: 16px;#}

        }

        .optionType ul li {
            padding: 4px 19px 2px 19px;
            text-align: left;
        }

        .optionType ul li:hover {
            background: #f9f9f9;
        }
    </style>
</head>
<body ng-app="logMag" ng-controller="logManageCtrl">
<div class="content">
    <div style="padding: 19px 0;">收集管理>我的分享</div>
    <div class="shareTable">
        <div class="tabelSty">
            <table class="col-sm-12 table table-striped tabList">
                <thead>
                <tr>
                    <th width="2%"></th>
                    <th width="11%">标题</th>
                    <th width="9%">大小</th>
                    <th width="11%">分享时间</th>
                    <th width="12%">分享人</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="item in dataList1">
                    <td><input type="checkbox"></td>
                    <td ng-bind="item.title"></td>
                    <td ng-bind="item.size"></td>
                    <td ng-bind="item.share_time"></td>
                    <td ng-bind="item.share_from"></td>
                </tr>
                </tbody>
            </table>
        </div>
        <div id="demo7" class="pag"></div>
    </div>
</div>
<script type="text/javascript" src="/static/assets/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/static/assets/js/bui-min.js"></script>
<script type="text/javascript" src="/static/datepicker/js/moment.min.js"></script>
<script type="text/javascript" src="/static/plugins/angular/angular.min.js"></script>
<script type="text/javascript" src="/static/assets/js/config-min.js"></script>
<script type="text/javascript" src="/static/plugins/layui/js/layui.js"></script>
<script type="text/javascript" src="/static/plugins/PNotify/pnotify.custom.min.js"></script>
<script type="text/javascript" src="/static/plugins/pnotify.js"></script>
<script type="text/javascript" src="/static/plugins/jquery.treetable.js"></script>
<script type="text/javascript" src="/static/plugins/angular-ui/ui-bootstrap-tpls.min.js"></script>
<script type="text/javascript">
    var app = angular.module('logMag', ['soc.PNotify', 'ui.bootstrap']);
    app.controller('logManageCtrl', function ($scope, $http, $rootScope, serPNotify, $modal) {
        $scope.optionTypeShow = '';
        $rootScope.myShareList = function () {
            $http({
                url: '/api/share/myshare',
                method: "POST",
                data: {}
            }).then(function (resp) {
                console.log("resp", resp);
                $scope.dataList = resp.data.data;
                //分页
                layui.use(['laypage', 'layer'], function () {
                    var laypage = layui.laypage
                        , layer = layui.layer;
                    laypage.render({
                        elem: 'demo7'
                        , count: $scope.dataList.length
                        , layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                        , jump: function (obj) {
                            //obj.curr得到当前页，以便向服务端请求对应页的数据。
                            //obj.limit得到每页显示的条数
                            $scope.dataList1 = $scope.dataList.slice((obj.curr - 1) * obj.limit, obj.curr * obj.limit);
                            $scope.$applyAsync();
                        }
                    });
                })
            }, function (err) {
                serPNotify.error("接口请求失败");
            });
        };
        $rootScope.myShareList();

        $scope.showOperation = function (id) {
            $scope.optionTypeShow = id;
        };
        //取消模态框
        $scope.cancelShare = function (id) {
            $scope.optionTypeShow = '';
            $modal.open({
                templateUrl: '/static/html/myShare/cancelShare.html',
                controller: 'cancelShareCtrl',
                scope: $scope,
                resolve:{
                   params: function () {
                    return id;
                  }
                }
            });
        }
    })
    app.controller('cancelShareCtrl', function ($scope, $http, $rootScope, serPNotify, $modal, params, $modalInstance) {
        $scope.confirm = function () {
            $modalInstance.close();
            $http({
                url: '/api/share/deldoc',
                method: "POST",
                data: {id: params}
            }).then(function (resp) {
                if(resp.data.success=="1"){
                    serPNotify.success("取消分享成功");
                    $rootScope.myShareList();
                }else{
                    serPNotify.error("接口请求失败");
                }
            }, function (err) {
                serPNotify.error("接口请求失败");
            });
        }
        $scope.cancel = function () {
            $modalInstance.dismiss();
        };
    })
</script>
</body>
</html>  